#!/bin/bash
# Script to invoke chaincode
{% include "envsetting.j2" %}
peer chaincode invoke -o $ORDERER_ADDRESS --cafile $ORDERER_TLS_CA \
  --tls -C {{CHANNEL_NAME}} -n {{ CC_NAME }}  \
{% if endorsingpeers|length > 0 %}
{% for endorser in endorsingpeers %}
  --peerAddresses {{ endorser.endpoint }} \
  --tlsRootCertFiles {{ endorser.tlsca }} \
{% endfor %}
{% endif %}
{% if TRANSIENT_DATA != 'Cg==' %}
  --transient '{{ TRANSIENT_DATA|b64decode|trim }}' \
{% endif %}
  -c '{"Args":[{{ CC_PARAMETERS|b64decode|trim }}]}'
